#ifndef MATRIX2_H
#define MATRIX2_H
#include <math.h>
#include <iostream>
#include "Vector2.h"

using namespace std;

/*
*	___ Matrix2 Header___
*
*
**************************************************************
*/

struct MatrixElements
{
	public: float e11,e12,e13,  e21,e22,e23,  e31,e32,e33; 
};

class Matrix2
{


	private:
		//   +---+---+---+
		//   |e11 e12 e13|
		//   |e21 e22 e23|
		//	  |e31 e32 e33|
		//   +---+---+---+
		MatrixElements _elements;
	public:
		//Constructors
		
		Matrix2();

		Matrix2(const Matrix2 &mat);

		Matrix2( float e11,float e12, float e21,float e22 );

		Matrix2( float e11,float e12,float e13, float e21,float e22, float e23, float e31,float e32, float e33 );		

		Matrix2( MatrixElements elements );
		
		//Getter/Setter
		MatrixElements getElements() const;
		
		void setElements( MatrixElements elements);

		//Overload Operators
		Matrix2 operator * (const Matrix2 &mat2) const;

		Matrix2 operator * (const float& scal) const;

		Vector2 operator * (const Vector2 &vec) const;

		Matrix2 operator + (const Matrix2 &mat2) const;

		Matrix2 operator - (const Matrix2 &mat2) const;

		float getDeterminant() const;

		Matrix2 getInverse() const;

		void InverseMatrix();

		//Transformations
		static Matrix2 Scale( float xFactor, float yFactor )
		{
			Matrix2 mat(xFactor,0.0,0.0, 0.0,yFactor,0.0,0.0,0.0,1.0);
			return mat;
		}

		static Matrix2 Translate( float deltaX, float deltaY )
		{
			Matrix2 mat(1.0,0.0,deltaX, 0.0,1.0,deltaY,0.0,0.0,1.0);
			return mat;
		}

		static Matrix2 Rotate( float rad )
		{
			Matrix2 mat(cos(rad),-sin(rad),0.0,sin(rad),cos(rad),0.0,0.0,0.0,1.0);
			return mat;
		}
		
		Vector2 MultNormal( Vector2 normal ) const;

		friend ostream & operator<< (ostream &o, const Matrix2 &mat);
};


/***************************************************************/
#endif
